<template>
	<u-sticky h5-nav-height="0">
		<u-tabs font-size="28" :gutter="30" :list="tabsList" active-color="#117B12" :is-scroll="true"
			v-model="tabsCurrent" @change="tabsChange"></u-tabs>
	</u-sticky>
	<view class="u-p-28"> 
		<template v-for="(v,i) in list" :key="v.sid">
			<view class="bgw box-radius u-p-l-28 u-p-r-28 u-font-24">
				<view class="u-border-bottom u-p-t-24 u-p-b-24">
					<view class="u-flex">
						<view class="u-flex-1">
							订单编号：{{v.orderCode}}
						</view>
						<view class="">
							<order-status-text v-model="v.orderStatus"></order-status-text>
						</view>
					</view>
					<view class="u-flex u-m-t-16">
						购买用户：{{v.user.nickName}}
					</view>
				</view>
				<template v-for="k in v.productList">
					<item :detail="k" type="order">
						<template v-slot:right>
							<view class="">
								x{{k.count}}
							</view>
						</template>
					</item>
				</template>
				<view class="u-flex u-p-b-24 u-p-t-24">
					<view class="u-flex-1"></view>
					<view class="">
						<text>预佣金：</text>
						<text class="color-primary">￥{{v.commission}}</text>
					</view>
				</view>
			</view>
			<u-gap height="20"></u-gap>
		</template>
		<g-loadmore :status="loadmoreStatus"></g-loadmore>
	</view>
</template>


<script setup>
	import mixinList from '@/common/js/mixinList.js';
	import orderRentItem from '@/pagesSub/components/order-rent-item.vue';
	import store from '@/store/index.js'; //需要引入store
	import {
		ref,
		reactive,
		computed,
		getCurrentInstance,
		watch
	} from 'vue'
	import {
		onReady,
		onLoad,
		onShow
	} from '@dcloudio/uni-app'
	const {
	  proxy,
	} = getCurrentInstance()
	const {
		nav,
		navLogin
	} = proxy.$util;
	const {
		total,
		current_page,
		page_size,
		last_page,
		apiPath,
		loading,
		list,
		searchParams,
		getList,
		getNextList,
		loadmoreStatus,
		searchClear,
		searchConfirm
	} = mixinList();
	apiPath.value = 'getShareOrder'

	const tabsCurrent = ref(0)
	// 订单状态：0=待支付，1=待发货，2=待收货，3=待评价，4=已完成 5=已取消 10=挂单
	const tabsList = [{
			name: '全部',
			id: ''
		},
		{
			name: '待付款',
			id: 0
		},
		{
			name: '待发货',
			id: 1
		},
		{
			name: '待收货',
			id: 2
		},
		{
			name: '待评价',
			id: 3
		},
		{
			name: '已完成',
			id: 4
		},
		{
			name: '已取消',
			id: 5
		},
	];
	searchParams.orderStatus = computed(()=>{
		return tabsList[tabsCurrent.value].id
	});
	watch(tabsCurrent, async (val) => {
	    await getList(1)
	})
	const tabsChange = (index) => {}
	onReady(() => {
	
	})
	onLoad((d) => {
		getList(1)
	})
	onShow(()=>{
		
	})
	
</script>

<style lang="scss" scoped>

</style>